package com.yongbao.controller.wechat;

import com.yongbao.common.WebResponse;
import com.yongbao.common.annotation.WebAccess;
import com.yongbao.model.request.AreaStreetRequest;
import com.yongbao.model.vo.AreaStreetTreeVO;
import com.yongbao.model.vo.AreaStreetVO;
import com.yongbao.service.AreaStreetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

/**
 * @author zhanghong
 */
@RestController
@RequestMapping("/wechat/areaStreet")
@Api(value = "【小程序】区/街道模块", tags = {"【小程序】区/街道模块"})
public class WechatAreaStreetController {

    @Autowired
    private AreaStreetService areaStreetService;

//    @WebAccess(login = true)
//    @ApiOperation(value = "根据主键查询", httpMethod = "POST")
//    @ApiResponses(value = {@ApiResponse(code = 200, message = "success")})
//    @PostMapping("/get/{id}")
//    public WebResponse<AreaStreetVO> getByKey(HttpServletRequest request, @PathVariable("id") long id) {
//        return WebResponse.build(areaStreetService.getByKey(id));
//    }

    //@WebAccess(login = true)
    //@ApiOperation("分页查询")
    //@PostMapping("/pageQuery")
    //public WebResponse<PageInfo<AreaStreetVO>> pageQuery(@RequestBody AreaStreetRequest request) {
    //    return WebResponse.build(areaStreetService.pageQuery(request));
    //}

    @WebAccess(login = true)
    @ApiOperation("列表查询")
    @PostMapping("/listQuery")
    public WebResponse<List<AreaStreetTreeVO>> listQuery(@RequestBody AreaStreetRequest request) {
        return WebResponse.build(areaStreetService.listQuery(request));
    }
}
